{extend name="public/base" /}
{block name="container"}
<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>客户列表</h5>
                    </div>
                    <div class="ibox-content">
                      <form action="" method="post">
                        <div class="row">
                            <!-- <div class="col-sm-5 m-b-xs">
                                <select class="input-sm form-control input-s-sm inline">
                                    <option value="0">选择会员等级</option>
                                    {volist name="level" id="le"}
                                    <option value="{$le.id}">{$le.title}</option>
                                    {/volist}
                                </select>
                            </div> -->
                           <!--  <div class="col-sm-4 m-b-xs">
                               <div data-toggle="buttons" class="btn-group">
                                   <label class="btn btn-sm btn-white">
                                       <input type="radio" id="option1" name="options">天</label>
                                   <label class="btn btn-sm btn-white active">
                                       <input type="radio" id="option2" name="options">周</label>
                                   <label class="btn btn-sm btn-white">
                                       <input type="radio" id="option3" name="options">月</label>
                               </div>
                           </div> -->
                            <div class="col-sm-3" style="float: right;">
                                <div class="input-group">
                                    <input type="text" placeholder="请输入关键词" name="name" class="input-sm form-control"> <span class="input-group-btn">
                                        <button type="submit" class="btn btn-sm btn-primary"> 搜索</button> </span>
                                </div>
                            </div>
                            <div class="col-sm-8">
                                          <div class="input-group" >
                                            <a href="{:url('index/customer/sendSms')}" class="btn btn-sm btn-primary" >发送短信</a >
                                          </div>
                                        </div>
                        </div>
                      </form>
                        <div class="table-responsive">
                            <table class="table table-striped">
                                <thead>
                                    <tr>

                                        <th>序号</th>
                                        <th>姓名</th>
                                        <th>性别</th>
                                        <th>年龄</th>
                                        <th>联系方式</th>
                                        <th>会员等级</th>
                                        <th>所属店铺</th>
                                        <th>所属用户</th>
                                        <th>客户来源</th>
                                        <th>客户类型</th>
                                        <th>状态</th>
                                        <th>操作</th>

                                    </tr>
                                </thead>
                                <tbody>
                                    <tr>
                                    	{volist name="list" id="vo"}
                                        <td>
                                            <input type="checkbox"  class="i-checks" name="input" value="{$vo.id}">{$vo.id}
                                        </td>
                                        <td>{$vo.name}</td>
                                        <td>{$vo.sex}</td>
                                        <td>{$vo.age}</td>
                                        <td>{$vo.phone}</td>
                                        <td>{$vo.level}</td>
                                        <td>{$vo.shop}</td>
                                        <td>{$vo.user_name}</td>
                                        <td>{$vo.from}</td>
                                        <td>{$vo.is_New}</td>
                                        <td>
										{if condition="$vo['status'] eq 1"}	
                                        	<i class="glyphicon glyphicon-ok-sign text-success"></i>
										{else /}
											<i class="glyphicon glyphicon-remove-sign text-danger"></i>
										{/if}
                                        </td>
                                        <td>
                                            <a href="{:url('index/customer/show',array('id'=>$vo['id']))}" title="查看"><i class="iconfont icon-chakan"></i></a>
                                                &emsp;
                                            <a href="javascript:;" onclick="delcust({$vo['id']})"  title="删除"><i class="iconfont icon-shanchu"></i></a>

                                        </td>
                                    </tr>
                                    {/volist}
                                </tbody>
                            </table>
                             <div style="float: right;">
                              {$page}
                           </div>
                        </div>

                    </div>
                </div>
            </div>

        </div>
    </div>
{/block}
{block name="js"}
    <!-- Peity -->
    <script src="__INDEX__/js/plugins/peity/jquery.peity.min.js"></script>

    <!-- 自定义js -->
    <script src="__INDEX__/js/content.js?v=1.0.0"></script>


    <!-- iCheck -->
    <script src="__INDEX__/js/plugins/iCheck/icheck.min.js"></script>

    <!-- Peity -->
    <script src="__INDEX__/js/demo/peity-demo.js"></script>

    <script>
        $(document).ready(function () {
            $('.i-checks').iCheck({
                checkboxClass: 'icheckbox_square-green',
                radioClass: 'iradio_square-green',
            });
        });
    </script>
    <script>
        function delcust(id)
        {
          swal({   
            title: "确定要删除数据?",   
            text: "确认将删除该条数据!",   
            type: "warning",   
            showCancelButton: true,    
            confirmButtonText: "确认", 
            cancelButtonText: '取消',
            closeOnConfirm: false
        }, function(){   
          $.post('{:url("index/customer/delcust")}', {'id':id}, function(data) {
            if(data.sta == -1 ){
                    swal({
                    title: "权限不足",
                    text: "",
                    type: "error"
                });
            }else if(data.sta == 1){
                     swal({
                    title: "删除成功",
                    text: "",
                    type: "success"
                });
                     window.location.reload();
            }else{
                    swal({
                    title: "删除失败",
                    text: "",
                    type: "error"
                });                
            }
          });
      });
      }
  </script>
    </script>
{/block}